<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

<h:head>
    <title>Edit Profile</title>
</h:head>

<h:body onload="#{ProfileEM.searchByName()}">
<h:form>
    <p:menubar>  
    <p:menuitem value="Home" url="home.xhtml" /> 
        <p:submenu label="Package Section" >  
            <p:menuitem value="All Packages" url="package.xhtml" />  
        </p:submenu>  
  
        <p:submenu label="Gift List" >  
            <p:menuitem value="My Gift List" url="giftList.xhtml" />    
        </p:submenu>  
  
       <f:facet name="options">   
       		<p:commandButton value="Edit Profile" action="profileEdit.xhtml"/>
            <p:commandButton value="Logout" action="#{LoginManaged.logout()}" icon="ui-icon-close" />
       </f:facet>
    </p:menubar>  
    </h:form>
	<p:panel header="Edit Profile">
	<h:form>
		<h:panelGrid columns="3">
			<p:outputLabel value = "Username:"/>
			<p:outputLabel id="username" value="#{ProfileEM.reDTO.idUser}"/>
			<p:outputLabel value = "Not editable"/>
			
			<p:outputLabel value="New Password:"/>
	        <p:password id="password" value="#{ProfileEM.reDTO.password}"
	                         feedback="true" match="confirmPassword" label="Password"/>
	        <p:message for="password"/>
	        <p:outputLabel value="Confirm New password:"/>
	        <p:password id="confirmPassword" label="Confirm password"
	                        value="#{ProfileEM.reDTO.password}"/>
	        <p:message for="confirmPassword" />
	                        
			<p:outputLabel value = "Phone Number:"/>
			<p:inplace>
			<p:inputText id="phone" value="#{ProfileEM.reDTO.phone}" required="true"/>
			</p:inplace>
			<p:message for="phone" />
			
			
			<p:outputLabel value = "Address:"/>
			<p:inplace editor="true">
			<p:inputText id="address" value="#{ProfileEM.reDTO.address}" required="true"/>
			</p:inplace>
			<p:message for="address" />

			<p:outputLabel value = "Name:"/>
			<p:inplace editor="true">
			<p:inputText id="name" value="#{ProfileEM.reDTO.name}" required="true"/>
			</p:inplace>
			<p:message for="name" />
			
			<p:outputLabel value = "Surname:"/>
			<p:inplace editor="true">
			<p:inputText id="surname" value="#{ProfileEM.reDTO.surName}"  required="true"/>
			</p:inplace>
			<p:message for="surname" />
			
		</h:panelGrid>
		<p:commandButton value="Save" action="#{ProfileEM.save}" ajax="false" />
	</h:form>
	</p:panel>
	<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
</h:body>

</html>